XML Column Extract![CDATA[ ]]?

There is nothing special with CDATA sections.

There is nothing special with CDATA sections. Declare @xml xml = ' /m/967558/40. Jpg Slmnoasp' select @xml.

Value('/productDetailsDescription1', 'nvarchar(225)') It also handles mixed values. Declare @xml xml = '123456' select @xml. Value('/root1', 'nvarchar(10)') Result: (No column name) 123ABD456 Edit From a table instead of a variable with a cast to XML: select cast(xml as xml).

Value('/productDetailsDescription1', 'nvarchar(max)') as productDetailsDescription from YourTable Try it here: data.stackexchange.com/stackoverflow/q/1... Edit 2 You need to specify the node names in the query. You also have to decide if you should have the different nodes in the same column or if they should be in different columns. Below I show you how you can do both.

Declare @T table(xml nvarchar(max)) insert into @T values (' /m/967558/40. Jpg Slmnoasp') insert into @T values (' /m/967558/40. Jpg Slmnoasp') -- Get detailDescription in a column of its own select cast(xml as xml).

Value('/productDetailsDescription1', 'nvarchar(max)') as productDetailsDescription, cast(xml as xml). Value('/detailDescription1', 'nvarchar(max)') as detailDescription from @T -- Get detailDescription in the same column as productDetailsDescription select cast(xml as xml). Value('/*local-name()=("productDetailsDescription","detailDescription")1', 'nvarchar(max)') as detailDescription from @T.

Thanks for you response...I have not declared any variables...so just looking on extracting data through existing query...kindly help editing the CAST(xml as xml). Value('(//! CDATA productDetailsDescription)1','nvarchar(225)') as prDetDesc line in the query since I am getting null as the record.

Thanks – user868765 Aug 4 at 13:33 Data is being returned as NULL for the productDetailsDescription field I am using this statement - CAST(xml as xml). Value('/productDetailsDescription1','varchar(max)')as productDetailsDescription – user868765 Aug 4 at 13:46 @user If you get NULL it probably means that your XML does not look like this sample. The first single / in the path specifies the root so productDetailsDescription has to be a root node.

If it is not, the best you could do for performance sake is to add the full path. Next best would be to use two // instead of only one to do a search in the XML for the node. – Mikael Eriksson Aug 4 at 13:59 Thanks Mikael...as you say I am getting records for some nodes....but for some I am not getting - this is the format for which data is not being extracted – user868765 Aug 4 at 14:07 @user - You need to specify the nodes you want in the query.

I have updated the answer. – Mikael Eriksson Aug 4 at 15:15.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions